<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
 <c:set var="ctx" value="${pageContext.request.contextPath }"></c:set>
     <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="chenxing-technology">
    <meta name="keyword" content="">
    <link rel="shortcut icon" href="<%=request.getContextPath()%>/resources/img/favicon.ico">
    <title>樱桃管理</title>
    <!-- Bootstrap CSS -->    
    <link href="<%=request.getContextPath()%>/resources/css/bootstrap.min.css" rel="stylesheet">
    <!-- bootstrap theme -->
    <link href="<%=request.getContextPath()%>/resources/css/bootstrap-theme.css" rel="stylesheet">
    <link href="<%=request.getContextPath()%>/resources/css/style.css" rel="stylesheet">
     <script src="<%=request.getContextPath()%>/resources/js/jquery-1.8.3.min.js" type="text/javascript" charset="utf-8"></script>
    
  </head>

  <body>
  <!-- container section start -->
  <section id="container" class="">
         
     <jsp:include page="heads.jsp" />

      <!--sidebar start-->
      <aside>
          <div id="sidebar"  class="nav-collapse ">
              <!-- sidebar menu start-->
              <ul class="sidebar-menu">                
                  <li class="sub-menu open">
                      <a href="javascript:;" class="">
                          <span>单据信息</span>
                          <span class="menu-arrow"></span>
                      </a>
                      <ul name="sub" class="sub">
                          <li><a class="" href="${ctx }/summary/summaryAdd">单据录入</a></li>                          
                          <li><a class="" href="${ctx }/summary/selectSum?pageNow=1">单据录入汇总</a></li>
                          <li><a class="" href="${ctx }/getTable/addGet">单据领取</a></li>
                          <li><a class="" href="${ctx }/getTable/showGet?pageNow=1">单据领取汇总</a></li>
                      </ul>
                  </li> 
				          <li class="sub-menu">
                      <a href="javascript:;" class="">
                          <span>商户录入</span>
                          <span class="menu-arrow"></span>
                      </a>
                      <ul name="sub" class="sub">
                          <li><a class="" href="${ctx }/meentry/addMeJsp">商户录入</a></li>                          
                          <li><a class="" href="${ctx }/meentry/showMeenAll?pageNow=1">商户录入汇总</a></li>
                          <li><a class="" href="${ctx }/meentry/orderlist">订单信息</a></li>
                      </ul>
                  </li>       
                  <li class="sub-menu">
                      <a href="${ctx }/meentry/farmerJsp" class="">
                          <span>农户录入</span>
                          <span class="menu-arrow"></span>
                      </a>
                  </li>
                  <li class="sub-menu">
                      <a class="" href="${ctx }/meentry/settlement?pageNow=1">
                          <span>结算信息</span>
                          <span class="menu-arrow"></span>
                      </a>
                  </li>
                 
              </ul>
               <div class="add-button text-center">
              	<a href="${ctx }/user/addUserJsp">添加账号</a>
              </div>
              <!-- sidebar menu end-->
          </div>
      </aside>
      <!--sidebar end-->
      
      <!--main content start-->
      <section id="main-content">
          <section class="wrapper">            
              <!--overview start-->
			        <div class="row document-input form-input">
			        	  <div class="img-ico div-center text-center">
                      <img src="<%=request.getContextPath()%>/resources/img/raw_1519608929.png"/>
                  </div> 
                  <div class="col-md-4 div-center input-content">
                  	<form action="${ctx }/summary/insertSum" id="feedback_form" onsubmit="return accoutest()" method="post" class="form-validate form-horizontal">                  	
                      <section class="panel">
                        <div class="panel-body">
                        	 <div class="form-group">
                              <label class="control-label col-sm-3">单据册号：</label>

                              <div class="col-sm-3">
                                  <input type="text" name="svolume" id="svolume" value="" class="cp1 form-control" placeholder="初始册号">
                              </div>
                              <div class="col-sm-2 text-center">
                                  ----
                              </div>
                              <div class="col-sm-3">
                                  <input type="text" name="scolumn1" id="scolumn1" value="" class="cp1 form-control" placeholder="结束册号">
                              </div>
                           </div> 
                           <div class="form-group">
                              <label class="control-label col-sm-3">单据号：</label>

                              <div class="col-sm-3">
                                  <input type="text" name="sinitiate" id="sinitiate" value="" class="cp1 form-control" placeholder="初始单号">
                              </div>
                              <div class="col-sm-2 text-center">
                                  ----
                              </div>
                              <div class="col-sm-3">
                                  <input type="text" name="sfinish" id="sfinish" value="" class="cp1 form-control" placeholder="结束单号">
                              </div>
                           </div> 
                        </div>
                      </section>
                      <div class="form-group">
                        <div class="col-lg-12 text-center">
                        	<button class="btn btn-default" type="button" onClick="history.back()">取消</button>
                          <button class="btn btn-primary" type="submit">提交</button>                   
                        </div>
                      </div>
                   </form>
                  </div>                  
              </div>
          </section>
      <!--main content end-->
     </section>
     
     <script type="text/javascript">
	     $(function() {
		     var menu = $(".sidebar-menu .sub-menu")
		     menu.click(function() {
		         i = $(this).index();
		         $(this).addClass("open").siblings().removeClass("open");
		         $(this).children(".sub").addClass("current");
		         $(this).siblings().children(".sub").removeClass("current");
		     })
	     })
     </script>
     <script type="text/javascript">
     	function accoutest(){
			var svolume = document.getElementById("svolume").value;
			var scolumn1 = document.getElementById("scolumn1").value;
			var sinitiate = document.getElementById("sinitiate").value;
			var sfinish = document.getElementById("sfinish").value;
			if(svolume==null||svolume==""||svolume==undefined){
				alert("请输入初始册号");
				return false;
			}
			if(scolumn1==null||scolumn1==""||scolumn1==undefined){
				alert("请输入结束册号");
				return false;
			}
			if(sinitiate==null||sinitiate==""||sinitiate==undefined){
				alert("请输入初始单号");
				return false;
			}
           if(sfinish==null||sfinish==""||sfinish==undefined){
           		alert("请输入结束单号");
				return false;
           }
			
		  
		  /* 重复数据查询 */
		  var   boo='';
			$.ajax({
		                url : '<%=basePath%>summary/sumTest',
		                data:{"svolume": svolume,"scolumn1":scolumn1,},
		                type : 'post',
		                dataType : 'json',
		                async : false,
		                success : function(data) {
		                       if(data!=null){
		                          if(data.result=='1'){
		                          		alert("您输入的册号已经存在，无法添加");
		                          		boo='a';
		                          		return  false;
		                          } 
		                           if(data.result=='0'){
		                           		boo='b';
		                          		return  true;
		                          } 
		                       }                                                    
		                }
		         })
		         if(boo=='a'){
		        	 return  false;
		         }
		  
		  
		} 
     </script>
  </body>
</html>